package com.ctl.controller;

import com.ctl.config.LoginToken;
import com.ctl.dto.VideoDTO;
import com.ctl.service.VideoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/videos")
public class VideoController {
    @Autowired
    private VideoService service;

    @Autowired
    private LoginToken loginToken;
    @GetMapping
    public VideoDTO getAll(String token, Integer page, Integer per_page,
                                 Integer id,String name,Integer category_id,String uploader_name){
        loginToken.runExeption(token);
        System.out.println("page = " + page);
        System.out.println("pre_page = " + per_page);
    return service.getByAll(page,per_page,id,name,category_id,uploader_name);

    }

}
